package de.fmannan.wildit.ui;

import java.util.Calendar;

import de.fmannan.wildit.persistence.PersistenceProvider;
import android.app.TimePickerDialog;
import android.app.TimePickerDialog.OnTimeSetListener;
import android.widget.TimePicker;

public class RealityCheckEndTimePicker extends TimePickerActivity {

	@Override
	protected OnTimeSetListener getListener() {
		return new TimePickerDialog.OnTimeSetListener() {
			
			public void onTimeSet(TimePicker view, int hourOfDay,
					int minuteOfHour) {
				Calendar newTime = Calendar.getInstance();
				newTime.set(Calendar.HOUR_OF_DAY, hourOfDay);
				newTime.set(Calendar.MINUTE, minuteOfHour);
				
				//Store the new time to the database
				PersistenceProvider.getPersistenceProvider(view.getContext()).setAlarmEndTime(newTime);				
				finish();
			}
		};
	}
}
